ostree.git
9 years agodocs: Add a section on Docker
Colin Walters [Thu, 30 Jun 2016 19:29:28 +0000 (15:29 -0400)]
docs: Add a section on Docker

This could have a lot more obviously, but just laying down my thoughts
as a starting point.

Closes: #374
Approved by: jlebon

9 years agodelta: Add --if-not-exists option
Colin Walters [Fri, 1 Jul 2016 18:39:49 +0000 (14:39 -0400)]
delta: Add --if-not-exists option

I often want to have "idempotent" systems that iterate to a known
state.  If after generating a commit, the system is interrupted, I'd
like the next run to still generate a delta.  But we don't want to
regenerate if one exists, hence this option.

Closes: #375
Approved by: jlebon

9 years agobuild: Override systemd unit directory for distcheck
Dan Nicholson [Mon, 27 Jun 2016 20:06:23 +0000 (13:06 -0700)]
build: Override systemd unit directory for distcheck

distcheck tests that all the files are installed under $prefix. That
doesn't work with the systemd unit directory since the path comes from
pkg-config. Override the setting to be under $prefix in that case.

Closes: #372
Approved by: cgwalters

9 years agotests: Improve check for /proc/cmdline kargs
Dan Nicholson [Fri, 13 May 2016 19:53:01 +0000 (12:53 -0700)]
tests: Improve check for /proc/cmdline kargs

On some systems there may be no root= argument, so the tests for
appending /proc/cmdline arguments will fail. Instead, loop over each of
the arguments in the host's /proc/cmdline and test that they're in the
constructed config file. That will actually test if ostree added all of
the system's /proc/cmdline args correctly. The regex isn't perfect here,
but it's probably good enough for this test.

Closes: #372
Approved by: cgwalters

9 years agotests: Remove extra $CMD_PREFIX from test-auto-summary.sh
Dan Nicholson [Fri, 13 May 2016 18:38:50 +0000 (11:38 -0700)]
tests: Remove extra $CMD_PREFIX from test-auto-summary.sh

$OSTREE already has $CMD_PREFIX in it, so adding it again causes you to
call env twice with LD_PRELOAD.

Closes: #372
Approved by: cgwalters

9 years agobuild: Distribute libglnx and bsdiff Makefile templates
Dan Nicholson [Fri, 13 May 2016 18:01:29 +0000 (11:01 -0700)]
build: Distribute libglnx and bsdiff Makefile templates

In order to re-run autogen.sh from the tarball, the libglnx and bsdiff
Makefile templates need to be provided.

Closes: #372
Approved by: cgwalters

9 years agotests: Ensure mutable deployments from libostreetest
Dan Nicholson [Fri, 13 May 2016 17:22:02 +0000 (10:22 -0700)]
tests: Ensure mutable deployments from libostreetest

When creating sysroots with libostreetest, we don't get the benefit of
the OSTREE_SYSROOT_DEBUG setting in libtest.sh. That means we'll get
immutable deployments that can't be easily cleaned up.

Ensure the environment variable is set before creating new sysroots. It
would be nice to set the debug flags directly, but that's private API
that isn't currently pulled into libostreetest.

Closes: #372
Approved by: cgwalters

9 years agotests: Remove gpg verification files from EXTRA_DIST
Dan Nicholson [Fri, 13 May 2016 13:47:09 +0000 (06:47 -0700)]
tests: Remove gpg verification files from EXTRA_DIST

Follow on from 70a11189. These files are already disted.

Closes: #372
Approved by: cgwalters

9 years agoostree admin switch: fix short summary
Jonathan Lebon [Mon, 27 Jun 2016 17:59:22 +0000 (13:59 -0400)]
ostree admin switch: fix short summary

Closes: #371
Approved by: cgwalters

9 years agocheckout: Add an option to require hardlinks
Colin Walters [Sun, 26 Jun 2016 14:25:03 +0000 (10:25 -0400)]
checkout: Add an option to require hardlinks

I've seen a few people hit this and wonder why checkouts are slow/take
space.  Really, ensuring this happens is the *point* of OSTree.
Physical copies should be a last resort fallback for very unusual
situations (one of those is rpm-ostree checking out the db since
librpm doesn't know how to read from libostree).

Even I hit the fact that `/var` is a mountpoint disallowing hardlinks
with `/ostree` once and was confused.  =)

Add this to the rofiles-fuse test case because it creates a mount
point.

Closes: #368
Approved by: jlebon

9 years agorofiles-fuse: Do allow fchmod/fchown on directories
Colin Walters [Sun, 26 Jun 2016 14:23:56 +0000 (10:23 -0400)]
rofiles-fuse: Do allow fchmod/fchown on directories

The program is called ro*files* and ostree creates physical
copies of directories, so changing them is fine.

I hit this when trying to do a copy checkout onto an rofiles-fuse
mount.

Closes: #368
Approved by: jlebon

9 years agotests: fail the build if symlinking tests/ostree fails
Simon McVittie [Sun, 26 Jun 2016 12:57:13 +0000 (13:57 +0100)]
tests: fail the build if symlinking tests/ostree fails

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #367
Approved by: cgwalters

9 years agotests: use our own generated libtool, not the one in $PATH
Simon McVittie [Sun, 26 Jun 2016 12:56:05 +0000 (13:56 +0100)]
tests: use our own generated libtool, not the one in $PATH

libtoolize creates a version of libtool for the right architecture
in $(top_builddir), which is guaranteed to be present, and is
guaranteed to match what we are compiling (even during
cross-compilation).

Packaging systems sometimes separate /usr/bin/libtool, which is
specific to one architecture, from the libtool development files
such as libtoolize and ltmain.sh, which are architecture-independent.
For example, in Debian, libtool_*_all.deb contains the files necessary
to libtoolize a package and is depended on by the dh-autoreconf package,
but libtool-bin_*_amd64.deb (or whatever architecture) contains
/usr/bin/libtool and is not normally necessary to depend on.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #367
Approved by: cgwalters

9 years agoentry_pathname_test_helper: these tests need extended attributes
Simon McVittie [Sun, 26 Jun 2016 13:26:37 +0000 (14:26 +0100)]
entry_pathname_test_helper: these tests need extended attributes

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #366
Approved by: cgwalters

9 years agobuild-sys: Make libostree-1.so depend on the symbol file
Colin Walters [Fri, 24 Jun 2016 13:35:21 +0000 (09:35 -0400)]
build-sys: Make libostree-1.so depend on the symbol file

Otherwise one changing it doesn't cause a symbol to be exported.

Closes: #365
Approved by: jlebon

9 years agotests: Test partial commits for local remotes
Alexander Larsson [Tue, 7 Jun 2016 12:38:21 +0000 (14:38 +0200)]
tests: Test partial commits for local remotes

This was broken before, fixed in the previous commit.

Closes: #324
Approved by: yuqi-zhang

9 years agopull: Write commitpartial files for local imports too
Colin Walters [Tue, 7 Jun 2016 13:50:58 +0000 (09:50 -0400)]
pull: Write commitpartial files for local imports too

Just like HTTP fetches, these can be interrupted, so we need to write
the commitpartial files.

Closes: #324
Approved by: yuqi-zhang

9 years agorefs: resolve conflict between local/remote repos
Yu Qi Zhang [Thu, 23 Jun 2016 16:11:50 +0000 (16:11 +0000)]
refs: resolve conflict between local/remote repos

Add the functionality to use the same name for refs in local and remote
repos. This helps users keep track of local refs of remote origin, much
like local and remote git branches.

Previously, when a local ref is specified, resolve_refspec would fall
back to searching through remote repos if the ref is not found locally.
This function now takes an extra flag to specify whether it should
search through remote repos. Additionally, ostree_repo_resove_rev_ext
was added to call resolve_refspec with fallback_remote being false, so
refs --create would no longer complain when trying to create a local
ref of the same name as a remote one.

Fix remote repo parsing not being handled correctly on refs --create.

Closes: #363
Approved by: jlebon

9 years agopull: Correctly handle repo->parent_repo when applying static deltas
Alexander Larsson [Thu, 23 Jun 2016 09:51:15 +0000 (11:51 +0200)]
pull: Correctly handle repo->parent_repo when applying static deltas

In flatpak i was using a parent repo, and it failed to update
with ENOENT when dispatching an set-read-source opcode, because the
object it referenced was in the parent repo.

This fixes that by making _ostree_repo_read_bare_fd look
at parent_repo.

Closes: #362
Approved by: cgwalters

9 years agorefs: Fix a logic error
Mathnerd314 [Sat, 18 Jun 2016 17:06:31 +0000 (11:06 -0600)]
refs: Fix a logic error

I encountered the Opening remotes/ dir error with some broken pull code, and this fixes it.

Closes: #358
Approved by: cgwalters

9 years agocore: Add OSTREE_OBJECT_TYPE_COMMIT_META
Mathnerd314 [Thu, 16 Jun 2016 05:37:29 +0000 (23:37 -0600)]
core: Add OSTREE_OBJECT_TYPE_COMMIT_META

This is cleaner than the loose_path_with_suffix approach

Closes: #359
Approved by: cgwalters

9 years agoconfigure: Turn on -Wempty-body
Mathnerd314 [Thu, 16 Jun 2016 19:59:06 +0000 (13:59 -0600)]
configure: Turn on -Wempty-body

I spent half an hour debugging an extra semicolon,
and this C "feature" is not used at all in ostree

Closes: #359
Approved by: cgwalters

9 years agocore: Use OSTREE_SHA256_STRING_LEN instead of 64
Mathnerd314 [Sat, 18 Jun 2016 16:31:19 +0000 (10:31 -0600)]
core: Use OSTREE_SHA256_STRING_LEN instead of 64

Closes: #359
Approved by: cgwalters

9 years agocore: Fix wrong return value docs
Krzesimir Nowak [Wed, 22 Jun 2016 09:16:21 +0000 (11:16 +0200)]
core: Fix wrong return value docs

ostree_commit_get_parent() returns a string form of a checksum, not a
binary form.

Closes: #360
Approved by: cgwalters

9 years agorefs: allow overwrite of empty folders
Yu Qi Zhang [Mon, 20 Jun 2016 20:20:58 +0000 (20:20 +0000)]
refs: allow overwrite of empty folders

We noticed that once a ref folder is created, there is no existing
command that can remove it. For example, once "foo/bar" is created,
even if the user deletes foo or all the refs under foo, the folder
will persist.

Now when the user attempts to create a ref "foo" either through commit
or refs --create, if a folder "foo" exists but is empty of refs, the
folder is removed and the new ref "foo" is created.

New unit tests in tests-ref.sh verify this functionality.

Closes: #354
Approved by: cgwalters

9 years agolibglnx porting: Drop uses of gs_file_openat_noatime
Colin Walters [Wed, 15 Jun 2016 01:55:40 +0000 (21:55 -0400)]
libglnx porting: Drop uses of gs_file_openat_noatime

We're not really doing the "noatime" thing anymore.

Closes: #341
Approved by: jlebon

9 years agolib: Use g_file_enumerator_iterate() if available, with fallback
Colin Walters [Wed, 15 Jun 2016 01:51:10 +0000 (21:51 -0400)]
lib: Use g_file_enumerator_iterate() if available, with fallback

Import `gs_file_enumerator_iterate()` for the next six months or
so...after RHEL 7.3 is released I'm strongly considering hard
requiring 2.46 or so.

Likely at some point we should figure out how to share more "glib
backport" code with NetworkManager at least.

Closes: #341
Approved by: jlebon

9 years agolib: Use sd_journal directly (optionally)
Colin Walters [Tue, 14 Jun 2016 17:12:21 +0000 (13:12 -0400)]
lib: Use sd_journal directly (optionally)

This was the last caller of libgsystem that isn't
`gs_file_get_path_cached()`.  I think the use case ostree has where
the same code can be called via command line and via a shared library
*and* via a daemon is rather unusual, so let's just copy the code for
logging from libgsystem into here.

For example rpm-ostree hard depends on a daemon mode, so it'll just
use `sd_journal` directly.

Closes: #341
Approved by: jlebon

9 years agolibglnx porting: Use of GSDirFdIterator
Colin Walters [Tue, 14 Jun 2016 14:46:15 +0000 (10:46 -0400)]
libglnx porting: Use of GSDirFdIterator

This one was pretty simple.  One of the uses in `repo.c` was just a
leftover variable.

Closes: #341
Approved by: jlebon

9 years agolibostree.sym: Fix test-symbols
Colin Walters [Mon, 20 Jun 2016 22:13:58 +0000 (18:13 -0400)]
libostree.sym: Fix test-symbols

The test isn't smart enough to ignore comments, so change the prefix.

Closes: #356
Approved by: jlebon

9 years agoRelease 2016.6
Colin Walters [Mon, 20 Jun 2016 14:46:50 +0000 (10:46 -0400)]
Release 2016.6

9 years agopull: Ensure we always process queue only from main thread
Colin Walters [Fri, 17 Jun 2016 02:16:27 +0000 (22:16 -0400)]
pull: Ensure we always process queue only from main thread

I was easily reproducing a hang on pulls with thousands of requests on
current git master.  The initial symptom seemed to be that there are
multiple code paths where we don't invoke
`session_thread_process_pending_queue()`.  We really need to do
that any time we remove something from the outstanding queue,
to ensure it gets filled again.

A further issue is that we were tying the lifecycle of the pending
object to the `GTask`, but the task could be unref'd from the main
thread (via a `GSource` on the main thread), and that introduced
threadsafety issues, because the hash table and other data suddenly
could be concurrently modified.

Both of these need to be fixed together.  First, we introduce
`Arc<Pending>`, and ensure that both the main and worker threads hold
references.

Second, we ensure that we re-process the queue *immediately* whenever
a task is done, inside the worker thread, rather than doing it
incidentally via an unref.  This architecture is quite similar to what
the outside pull code is doing.

Closes: #350
Approved by: jlebon

9 years agotests: Support OT_SKIP_READDIR_RAND
Colin Walters [Fri, 17 Jun 2016 13:43:51 +0000 (09:43 -0400)]
tests: Support OT_SKIP_READDIR_RAND

For some reason I'm really not inclined to debug right now, `libtool`
is eating the `-fsanitize=address` argument when linking
`libreaddir-rand.so`, which causes failures since we're trying to
`LD_PRELOAD`.

Closes: #351
Approved by: jlebon

9 years agobuild: Fix libreaddir-rand to honor global CFLAGS
Colin Walters [Fri, 17 Jun 2016 13:36:51 +0000 (09:36 -0400)]
build: Fix libreaddir-rand to honor global CFLAGS

It's unfortunate that in automake one has to explicitly include the globa
`$(AM_CFLAGS)` if one sets `CFLAGS`, and similarly for other variables.

I'm trying to use `-fsanitize=address`, and not including it was
causing linker failures.

We also weren't inheriting the global warnings etc., so I had to fix a
decl-after-statement.

Closes: #351
Approved by: jlebon

9 years agomanual: Discuss mirroring
Colin Walters [Thu, 16 Jun 2016 15:25:37 +0000 (11:25 -0400)]
manual: Discuss mirroring

This should likely be its own section, but it makes enough sense here
for now too.

Closes: #347
Approved by: yuqi-zhang

9 years agorepo: Avoid a possible divide by zero in progress
Colin Walters [Fri, 17 Jun 2016 01:51:13 +0000 (21:51 -0400)]
repo: Avoid a possible divide by zero in progress

The previous code was subject to a divide by zero if less than a
second had passed.  Rework it so we only do the divide if more than a
second has passed.

Closes: #349
Approved by: Mathnerd314

9 years agolibglnx porting: delete temp files on failure of file creation
Yu Qi Zhang [Thu, 16 Jun 2016 18:51:10 +0000 (18:51 +0000)]
libglnx porting: delete temp files on failure of file creation

We noticed the temp files being left over in ostree when (mistakenly)
trying to create refs with names in use by folders. This fix removes
temp files created by glnx_file_replace_contents_at on failure.

Closes: #348
Approved by: cgwalters

9 years agoAdd "archive" as an alias for "archive-z2"
Colin Walters [Thu, 16 Jun 2016 14:07:26 +0000 (10:07 -0400)]
Add "archive" as an alias for "archive-z2"

I find the "-z2" is really a long ago relic of the past when I changed
the format.  We no longer have anything to do with the original
`archive`, so let's start allowing people to type `--mode=archive`
which just looks saner.

At some point later I'll update the docs too, but it'll be an annoying
transition period as we'll have to say "On older OSTree, use -z2" etc.

Closes: #346
Approved by: giuseppe

9 years agomanual: Link to mender.io
Colin Walters [Wed, 15 Jun 2016 13:20:11 +0000 (09:20 -0400)]
manual: Link to mender.io

Came out of a discussion on the list.

Closes: #344
Approved by: jlebon

9 years agorefs: add "ostree refs --create" and unit tests
Yu Qi Zhang [Tue, 14 Jun 2016 14:13:06 +0000 (14:13 +0000)]
refs: add "ostree refs --create" and unit tests

Added the ability to create a ref (much like a git tag) for an
existing commit through "ostree refs EXISTING --create=NEWREF".
Previously the only way to create a new ref was by creating a new commit,
but refs --create allows multiple refs to point to the same commit.

The command will fail if:
 - None/more than one existing ref is specified
 - The specified EXISTING tag does not exist, or was not specified
 - The specified NEWREF already exists, or is the name of a folder

Add unit tests in tests-ref.sh to verify above functionality

Closes: #340
Approved by: jlebon

9 years agolib: Port some manual close() cleanups to be glnx_fd_close
Colin Walters [Thu, 9 Jun 2016 18:30:14 +0000 (14:30 -0400)]
lib: Port some manual close() cleanups to be glnx_fd_close

Just noticed this while reading some code, we didn't have many manual
`out: close()` bits left, this pushes us over the edge to autocleanup
almost everywhere.

Closes: #332
Approved by: jlebon

9 years agobuild: re-create tests/ostree-symlink-stamp if Makefile changes
Simon McVittie [Sun, 12 Jun 2016 13:32:51 +0000 (09:32 -0400)]
build: re-create tests/ostree-symlink-stamp if Makefile changes

The filename of the real ostree executable could be either .libs/ostree
or .libs/lt-ostree.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agolibostreetest: include libtest.sh from srcdir, not builddir
Simon McVittie [Sun, 12 Jun 2016 13:21:19 +0000 (09:21 -0400)]
libostreetest: include libtest.sh from srcdir, not builddir

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agolibtest: make gpghome in tmpdir writeable
Simon McVittie [Sun, 12 Jun 2016 09:51:11 +0000 (10:51 +0100)]
libtest: make gpghome in tmpdir writeable

Otherwise, during "make distcheck" it will be read-only (because it
is a copy of the read-only ${srcdir} with permissions preserved), and
deletion will fail during cleanup.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agobuild: distribute more test files
Simon McVittie [Sun, 12 Jun 2016 09:45:48 +0000 (10:45 +0100)]
build: distribute more test files

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agobuild: distribute TAP helper scripts in tarballs
Simon McVittie [Sun, 12 Jun 2016 09:43:34 +0000 (10:43 +0100)]
build: distribute TAP helper scripts in tarballs

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agobuild: distribute test scripts in tarballs
Simon McVittie [Sun, 12 Jun 2016 09:39:46 +0000 (10:39 +0100)]
build: distribute test scripts in tarballs

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agobuild: distribute libostree.sym in tarballs
Simon McVittie [Sun, 12 Jun 2016 09:36:44 +0000 (10:36 +0100)]
build: distribute libostree.sym in tarballs

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agoautogen.sh: rely on VPATH for submodules' Makefile-*.am.inc
Simon McVittie [Sun, 12 Jun 2016 09:31:29 +0000 (10:31 +0100)]
autogen.sh: rely on VPATH for submodules' Makefile-*.am.inc

This avoids hard-coding the autogen-time ${srcdir} into our build
system, and might fix "make distcheck".

We don't need to specify ${srcdir} explicitly in the various variables,
because Automake always uses make's VPATH feature to look in both
${builddir} and ${srcdir} at build time.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agoLink libreaddir-rand to libdl
Simon McVittie [Sun, 12 Jun 2016 14:25:21 +0000 (10:25 -0400)]
Link libreaddir-rand to libdl

It uses dlsym(). There's no point in being extra-portable here
because OSTree only targets Linux anyway.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #336
Approved by: cgwalters

9 years agotest-sysroot.js: set "strict mode" when sourcing libtest.sh
Simon McVittie [Sat, 11 Jun 2016 18:07:40 +0000 (19:07 +0100)]
test-sysroot.js: set "strict mode" when sourcing libtest.sh

As with the C tests in commit 08580118, this makes sure the test
fails as soon as something goes wrong.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #335
Approved by: giuseppe

9 years agotests: Exit valgrind tests if a leak is detected
Alexander Larsson [Fri, 10 Jun 2016 11:28:08 +0000 (13:28 +0200)]
tests: Exit valgrind tests if a leak is detected

This fails the test if OT_TESTS_VALGRIND is set and valgrind
detects a leak.

Closes: #334
Approved by: cgwalters

9 years agopull: Fix leak of refs_to_fetch
Alexander Larsson [Fri, 10 Jun 2016 10:13:23 +0000 (12:13 +0200)]
pull: Fix leak of refs_to_fetch

Closes: #333
Approved by: giuseppe

9 years agopull: Fix leaked uri in request_static_delta_superblock_sync
Alexander Larsson [Fri, 10 Jun 2016 10:12:58 +0000 (12:12 +0200)]
pull: Fix leaked uri in request_static_delta_superblock_sync

Closes: #333
Approved by: giuseppe

9 years agopull: Fix leak of FetchObjectData in some cases
Alexander Larsson [Fri, 10 Jun 2016 10:12:33 +0000 (12:12 +0200)]
pull: Fix leak of FetchObjectData in some cases

Closes: #333
Approved by: giuseppe

9 years agopull: Fix leak of debug temporary strings
Alexander Larsson [Fri, 10 Jun 2016 10:12:07 +0000 (12:12 +0200)]
pull: Fix leak of debug temporary strings

Closes: #333
Approved by: giuseppe

9 years agolibotutil: Fix leak of VariantMapData
Alexander Larsson [Fri, 10 Jun 2016 10:10:37 +0000 (12:10 +0200)]
libotutil: Fix leak of VariantMapData

Closes: #333
Approved by: giuseppe

9 years agotests: Modernize valgrind infrastructure
Colin Walters [Wed, 11 May 2016 19:54:48 +0000 (15:54 -0400)]
tests: Modernize valgrind infrastructure

The recent memleak fixes motivated me to look at the bitrotted code to
run invocations of `ostree` in the test suite underneath valgrind.

There are a few things here.  First, update suppressions file from
libhif, since I recently worked on it.

When running *uninstalled* as we now support, we need
`libtool --mode=execute` in the mix so it expands out to
the uninstalled binary and we don't valgrind the intermediate shell.

However, it's harder than that because we chdir into a tmpdir,
which defeats the libtool logic.  AFAICS, the only fix for this
is to determine the realbin path before we chdir, and then unfortunately
we need to change every use of `ostree` to `${OSTREE}` =(

Then this immediately breaks for me on RHEL7 because my ancient
copy of `valgrind-3.10.0-16.el7.x86_64` is unaware of syscall 306, i.e.
`syncfs`.

But let's do this first before I dive into that.

Closes: #292
Approved by: krnowak

9 years agolib: Add OSTREE_SUPPRESS_SYNCFS environment variable
Colin Walters [Thu, 9 Jun 2016 14:49:03 +0000 (10:49 -0400)]
lib: Add OSTREE_SUPPRESS_SYNCFS environment variable

Just to work around valgrind not understanding the `syncfs()` syscall
in EL7 right now.

Closes: #292
Approved by: krnowak

9 years agolib: Fix a leak in remote parsing
Colin Walters [Wed, 11 May 2016 17:32:40 +0000 (13:32 -0400)]
lib: Fix a leak in remote parsing

As the docs say, `g_regex_match()` still allocates a match even if it
returns `FALSE`.  Using `g_autoptr` is just plain better.

Closes: #292
Approved by: krnowak

9 years agorelated-projects: Update with more information and projects
Mathnerd314 [Fri, 3 Jun 2016 20:14:49 +0000 (14:14 -0600)]
related-projects: Update with more information and projects

In particular, NixOS has changed somewhat, and Conda is worth
looking at. Also it seems reasonable to mention rpm-ostree /
Gnome Continuous.

Closes: #331
Approved by: cgwalters

9 years agodocs: Get API docs working again
Mathnerd314 [Sat, 4 Jun 2016 22:16:05 +0000 (16:16 -0600)]
docs: Get API docs working again

This changes around a few things that didn't work for me:
* Section names seem to be ostree-* instead of libostree-*
* Also XML files are ostree-* (they didn't show up at all)
- gtk-doc doesn't seem to parse const _OSTREE_PUBLIC correctly
* pull documentation is now on the actual functions rather than stubs
* Update gitignore with some more files

And there some changes to make gtk-doc give fewer warnings (not finished)

Closes: #327
Approved by: cgwalters

9 years agopull: Move pull and pull_onedir back into ostree-repo.c
Mathnerd314 [Wed, 1 Jun 2016 23:47:08 +0000 (17:47 -0600)]
pull: Move pull and pull_onedir back into ostree-repo.c

They call pull_with_options, which will fail anyway.

Closes: #327
Approved by: cgwalters

9 years agopull: Move libsoup-related code from ostree-repo.c to ostree-repo-pull.c
Mathnerd314 [Wed, 8 Jun 2016 18:48:44 +0000 (12:48 -0600)]
pull: Move libsoup-related code from ostree-repo.c to ostree-repo-pull.c

This centralizes the ifdef's in one file, which will make it
easier to write new pull backends.

ostree-repo-pull.c is now built unconditionally

Closes: #327
Approved by: cgwalters

9 years agorepo: use OSTREE_TIMESTAMP (=1) for checked-out files
Mathnerd314 [Wed, 8 Jun 2016 21:39:06 +0000 (15:39 -0600)]
repo: use OSTREE_TIMESTAMP (=1) for checked-out files

1 is a better choice than 0 because some programs use 0
as a special value; for example, GNU Tar warns of an
"implausibly old timestamp" with 0.

Closes: #330
Approved by: cgwalters

9 years agorepo: (minor) Drop a GFile usage in signature creation
Colin Walters [Fri, 3 Jun 2016 15:04:17 +0000 (11:04 -0400)]
repo: (minor) Drop a GFile usage in signature creation

Just one user of hundreds but, the rest of the function was ported
now.

Closes: #319
Approved by: jlebon

9 years agolib: Add a helper for mmap->bytes with openat(), use it in repo
Colin Walters [Fri, 3 Jun 2016 15:00:10 +0000 (11:00 -0400)]
lib: Add a helper for mmap->bytes with openat(), use it in repo

This kills another GSystem consumer...I think down the line I'd like
to do something like "detect whether file is > 1k if so, mmap,
otherwise just readall()" so we can use this helper in more places.

Closes: #319
Approved by: jlebon

9 years agolib: Add `_ALLOW_NOENT` flag to internal variant mapping API
Colin Walters [Fri, 3 Jun 2016 14:40:56 +0000 (10:40 -0400)]
lib: Add `_ALLOW_NOENT` flag to internal variant mapping API

We have a lot of "allow_noent" type wrapper functions since
a common pattern is to allow files to not exist, but still
throw cleanly on other issues.

This is another instance of that, and cleans up duplicated error
handling code.

Part of this is prep for moving away from `GFile` consumers.

Closes: #319
Approved by: jlebon

9 years agoglnx porting: Drop use of gs_file_openat_noatime
Colin Walters [Fri, 3 Jun 2016 14:22:05 +0000 (10:22 -0400)]
glnx porting: Drop use of gs_file_openat_noatime

As noted previously the "noatime" thing is mostly obsoleted by
relatime.

Closes: #319
Approved by: jlebon

9 years agolibglnx porting: Drop last use of gs_transfer_out_value()
Colin Walters [Fri, 3 Jun 2016 14:16:25 +0000 (10:16 -0400)]
libglnx porting: Drop last use of gs_transfer_out_value()

Closes: #319
Approved by: jlebon

9 years agoglnx porting: Drop last uses of gs_file_get_basename_cached()
Colin Walters [Fri, 3 Jun 2016 14:18:57 +0000 (10:18 -0400)]
glnx porting: Drop last uses of gs_file_get_basename_cached()

I apparently missed a few uses in the previous porting.

Closes: #319
Approved by: jlebon

9 years agorepo: Fix build on 32-bit systems
Krzesimir Nowak [Thu, 9 Jun 2016 10:42:28 +0000 (12:42 +0200)]
repo: Fix build on 32-bit systems

On 32-bit systems the modifier for printing 64bit values should be
%llu instead of %lu. Just use appriopriate macros that do the right
thing.

Closes: #329
Approved by: giuseppe

9 years agoconfigure.ac: properly check for bison
Jonathan Lebon [Tue, 7 Jun 2016 19:08:16 +0000 (15:08 -0400)]
configure.ac: properly check for bison

The AC_PROG_YACC already does the checking for us, so we don't need to
use AC_CHECK_PROGS (which wasn't working anyway because autoconf didn't
run the check thinking it was cached already from the earlier
AC_PROC_YACC, so we didn't get the default ":" value)

Closes: #325
Approved by: cgwalters

9 years agoostree_repo_write_commit: add missing docstring arg
Jonathan Lebon [Tue, 7 Jun 2016 18:44:55 +0000 (14:44 -0400)]
ostree_repo_write_commit: add missing docstring arg

Closes: #325
Approved by: cgwalters

9 years agotests/test-pull-c: New test that runs through the pull API via C
Colin Walters [Mon, 6 Jun 2016 18:49:11 +0000 (14:49 -0400)]
tests/test-pull-c: New test that runs through the pull API via C

We have had in the past issues with running `ostree_repo_pull()`
multiple times in the same process, embarassingly enough.  Nothing in
the current test suite covers this, so let's start.

Closes: #322
Approved by: jlebon

9 years agotests: Use strict mode by default for C tests
Colin Walters [Mon, 6 Jun 2016 19:00:13 +0000 (15:00 -0400)]
tests: Use strict mode by default for C tests

I was extending the C-based test suite to cover more, and noticed that
we weren't aborting if a command failed.  That made the tests somewhat
less useful, so let's fix it.

Closes: #321
Approved by: jlebon

9 years agosummary: Fix a typo
Krzesimir Nowak [Fri, 3 Jun 2016 19:35:52 +0000 (21:35 +0200)]
summary: Fix a typo

The --gpg-sign parameter will be used for signing the summary, not the
commit. This probably was copy-pasted from the ostree commit command.

Closes: #320
Approved by: cgwalters

9 years agoglnx porting: Port away from gs_file_get_basename_cached()
Colin Walters [Tue, 31 May 2016 15:35:35 +0000 (11:35 -0400)]
glnx porting: Port away from gs_file_get_basename_cached()

In some cases we use glnx_basename(), in others we already had a
`GFileInfo` around with the name.

Closes: #316
Approved by: jlebon

9 years agolibglnx porting: Port away from gs_file_map_noatime()
Colin Walters [Tue, 31 May 2016 15:27:19 +0000 (11:27 -0400)]
libglnx porting: Port away from gs_file_map_noatime()

The "no atime" thing was mostly useful only before "relative atime"
updates landed.  Users who care about performance will turn it off
entirely anyways.

Closes: #316
Approved by: jlebon

9 years agolib: Drop GFile variant mapping API for fd-relative
Colin Walters [Tue, 31 May 2016 15:53:27 +0000 (11:53 -0400)]
lib: Drop GFile variant mapping API for fd-relative

In addition to generic fd relative porting,
this is a necessary preparatory step for libglnx porting, because
when I tried to use `g_mapped_file_new` I hit an issue with
it using a different error domain from GIO.

Thankfully libglnx consistently uses the GIO error domain, and here
we're now using it for the `open()` call.

Closes: #317
Approved by: jlebon

9 years agolib: Change ot_util_variant_map helpers to consistently sink refs
Colin Walters [Wed, 1 Jun 2016 13:35:47 +0000 (09:35 -0400)]
lib: Change ot_util_variant_map helpers to consistently sink refs

This is similar to changes Krzesimir has been doing recently - we
really don't need the ergonomics of floating refs since we have
autocleanups.

We should continue to change most of our code to sink refs.

Specifically here it was pretty broken that the `_map()` API was
sinking but the other two weren't, and this broke some refactoring I
was trying to do later.

Closes: #317
Approved by: jlebon

9 years agorepo: Display estimated time remaining when pulling
Sam Spilsbury [Wed, 1 Jun 2016 08:15:00 +0000 (08:15 +0000)]
repo: Display estimated time remaining when pulling

Bug 765429 said that not having a time estimate can be annoying
when working with large pulls.

There isn't any complex time estimation logic here - we just take
the number of bytes remaining and do a linear projection of
the bytes per second rate at the current point in time.

Closes: #318
Approved by: cgwalters

9 years agocore: Port to new libglnx tempname API
Colin Walters [Sun, 29 May 2016 17:06:36 +0000 (13:06 -0400)]
core: Port to new libglnx tempname API

Drops another libgsystem use, and as bonus we malloc less too.

Closes: #311
Approved by: jlebon

9 years agosysroot: Correct error handling path in previous libglnx port
Colin Walters [Mon, 30 May 2016 15:20:18 +0000 (11:20 -0400)]
sysroot: Correct error handling path in previous libglnx port

I happened to have the github page open with my commit after it was
merged, and then noticed a bug.

We still need to throw if we hit a non-`ENOENT` error.

Closes: #315
Approved by: giuseppe

9 years agolibglnx porting: Port away from gs_file_ensure_directory()
Colin Walters [Sun, 29 May 2016 17:50:34 +0000 (13:50 -0400)]
libglnx porting: Port away from gs_file_ensure_directory()

The init-fs code in particular gets (IMO) a lot cleaner being fd
relative.

Closes: #312
Approved by: giuseppe

9 years agolibglnx porting: Port callers of gs_file_unlink to just unlink()
Colin Walters [Sun, 29 May 2016 17:33:25 +0000 (13:33 -0400)]
libglnx porting: Port callers of gs_file_unlink to just unlink()

In the second case it's actually less code too.

Closes: #312
Approved by: giuseppe

9 years agorepo: Port uncompressed cache GC to libglnx
Colin Walters [Sun, 29 May 2016 17:29:18 +0000 (13:29 -0400)]
repo: Port uncompressed cache GC to libglnx

 - Kills a user of `gs_file_unlink`
 - Is fd-relative
 - Is way less malloc-y.

Closes: #312
Approved by: giuseppe

9 years agolibglnx porting: Port "load utf8 file" contents API callers
Colin Walters [Sun, 29 May 2016 17:23:04 +0000 (13:23 -0400)]
libglnx porting: Port "load utf8 file" contents API callers

Closes: #312
Approved by: giuseppe

9 years agorepo: Add functions for verifying any data in repository
Krzesimir Nowak [Thu, 26 May 2016 09:54:28 +0000 (11:54 +0200)]
repo: Add functions for verifying any data in repository

This can be useful for validating the 3rd party data that is put in
the extensions directory and is signed with the same keys as commits
or the summary file.

Closes: #310
Approved by: cgwalters

9 years agorepo: Factor out setting up a GPG verifier
Krzesimir Nowak [Thu, 26 May 2016 09:53:11 +0000 (11:53 +0200)]
repo: Factor out setting up a GPG verifier

Moved out setting up a GPG verifier to a separate function, as I would
like to use it for the any data verification function in the following
commit.

Closes: #310
Approved by: cgwalters

9 years agorepo: Add a missing Returns paragraph
Krzesimir Nowak [Thu, 26 May 2016 09:51:13 +0000 (11:51 +0200)]
repo: Add a missing Returns paragraph

Closes: #310
Approved by: cgwalters

9 years agorepo: Factor out the check of gpg result to a separate function
Krzesimir Nowak [Thu, 26 May 2016 09:48:21 +0000 (11:48 +0200)]
repo: Factor out the check of gpg result to a separate function

I plan to add a function for verifying any data which may return the
error about lack of trusted signatures, so let's avoid the redundancy
and put the check in the separate function.

Closes: #310
Approved by: cgwalters

9 years agocore: Add a function creating an archive-z2 content stream
Krzesimir Nowak [Mon, 23 May 2016 11:28:04 +0000 (13:28 +0200)]
core: Add a function creating an archive-z2 content stream

It is quite similar to the already existing
ostree_raw_file_to_content_stream function, so I factored the common
part to a separate function. The difference is that we cannot report
the size of the resulting stream.

Can be useful for serving a "bare" repository as a faked "archive-z2"
repository.

Closes: #308
Approved by: cgwalters

9 years agocommit: Update manpage to reflect --editor
Mathnerd314 [Mon, 23 May 2016 19:32:36 +0000 (13:32 -0600)]
commit: Update manpage to reflect --editor

Closes: #305
Approved by: cgwalters

9 years agolog: Display "(no subject)" for commits without a subject
Mathnerd314 [Mon, 23 May 2016 18:52:56 +0000 (12:52 -0600)]
log: Display "(no subject)" for commits without a subject

This resolves the ambiguity for a message with a body but no subject,
and also hints that OSTree is using two bytes to store the empty
commit subject/body (when instead they could be stored, or rather,
not stored, as part of the metadata)

Closes: #305
Approved by: cgwalters

9 years agocommit: Don't require a subject
Mathnerd314 [Mon, 23 May 2016 18:49:37 +0000 (12:49 -0600)]
commit: Don't require a subject

In practice, a lot of subjects are empty, because the commit date
and branch are sufficient identification. For example, rpm-ostree
does not use subjects. It also doesn't use the command-line ostree
commit tool, so this was not a problem there, but this makes the
behavior consistent.

Also adds a test that empty subjects and omitting the subject
are equivalent. The --timestamp is so that the commits do not
have different timestamps.

Closes: #305
Approved by: cgwalters

9 years agocommit: Display subject/body in commit editor
Mathnerd314 [Mon, 23 May 2016 18:47:22 +0000 (12:47 -0600)]
commit: Display subject/body in commit editor

This allows automation to prefill the subject/body for the editor.

It could also be useful if some kind of "amend commit" functionality
was implemented.

Closes: #305
Approved by: cgwalters

9 years agocommit: Add --editor / -e command line argument
Mathnerd314 [Mon, 23 May 2016 18:44:36 +0000 (12:44 -0600)]
commit: Add --editor / -e command line argument

Previously, the behavior was to run the editor if no subject or body was specified.
This led to using commit -s '' in scripts, to avoid running the editor.
In practice, manually editing commit messages is rare, whereas automated scripting
is common, so instead default to not running the editor and only run it when -e
is given.

Closes: #305
Approved by: cgwalters

9 years agocommit: accept NULL subject argument
Mathnerd314 [Mon, 23 May 2016 18:42:17 +0000 (12:42 -0600)]
commit: accept NULL subject argument

When given a NULL subject, use "" instead, like for the body argument

Closes: #305
Approved by: cgwalters

9 years agoBuild on older versions of glib
Alexander Larsson [Wed, 25 May 2016 09:00:19 +0000 (11:00 +0200)]
Build on older versions of glib

Various places need to include libglnx.h for the autoptr backport
fallbacks to be there before ostree-autocleanups.h is included.

This fixes the build on centos7ยท

Closes: #309
Approved by: giuseppe